﻿namespace KAs.Cache;

public interface ICache
{
    void Set(string key, object value);
    void Set(string key, object value, TimeSpan timeSpan);
    Task SetAsync(string key, string value);
    Task SetAsync(string key, string value, TimeSpan timeSpan);
    Task<string> GetAsync(string key);
    Task RemoveAsync(string key);
    void Remove(string key);
    Task SetAsync(string key, object value);
    Task SetAsync(string key, object value, TimeSpan timeSpan);
    T Get<T>(string key);
    Task<T> GetAsync<T>(string key);
    Task<T> GetOrAddAsync<T>(string key, Func<Task<T>> func, TimeSpan expiredSeconds);
    Task<double> StringIncrementAsync(string key, double count);
    Task<int> StringIncrementAsync(string key, int count);
    Task<double> StringDecrementAsync(string key, double count);
    void Refresh(string key, TimeSpan timeSpan);
    Task RefreshAsync(string key, TimeSpan timeSpan);
}
